import React from 'react';
import { connect } from 'react-redux';

import BaseComponent from '../../components/common/baseComponent';

@connect()
class AliPay extends BaseComponent {
  componentDidMount() {
    if (!this.props.location.state || !document.forms[0]) {
      this.props.history.replace('/cq/home');
    } else {
      document.forms[0].submit();
    }
  }
  render() {
    const { state = { payinfo: '<div></div>' } } = this.props.location;
    return <div dangerouslySetInnerHTML={{ __html: state.payinfo }} />;
  }
}

export default AliPay;
